<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="bills" />
        <cc:attribute name="con" />
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>

        <h:outputStylesheet library="css" name="paySheet.css" ></h:outputStylesheet>
        <div style="position: relative!important;
             /*padding-left: 0.5%!important;*/
             height:95%!important;
             width:95%!important; 
             /*             overflow:hidden!important; */
             font-family: Times New Roman!important; 
             font-size: 10px!important; 
             margin:2px!important; 
             padding: 5px!important;
             /*             background-size: 100% auto!important;*/
             letter-spacing: 0px;
             /*             border: 1px solid!important;*/">

            <div class="institutionName" style="text-align: center!important;
                 font-weight: bold!important;
                 font-size: 15px!important;
                 font-weight: bold;">

            </div>
            <div style="font-size: 9px!important; font-family: Times New Roman!important;
                 letter-spacing: 0px; position: absolute!important; padding-left: 5%; padding-top: 5%;">
                <table >

                    <tr>
                        <td>
                            <!--<h:outputLabel value="Date : " />-->
                            <h:outputLabel value="Invoice No - #{cc.attrs.con.invoceNo}" />
                        </td>
                        <td></td>
                        <td></td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td>
                            <!--<h:outputLabel value="Date : " />-->
                            <h:outputLabel value="#{commonController.currentDateTime}">
                                <f:convertDateTime pattern="dd-MMM-yy" />
                            </h:outputLabel>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td>
                            <h:outputLabel value="#{cc.attrs.con.collectingIns.transAddress1},"/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            <h:outputLabel value="#{cc.attrs.con.collectingIns.transAddress2}"/>
                            <h:outputLabel value="." rendered="#{cc.attrs.con.collectingIns.transAddress3 eq null or cc.attrs.con.collectingIns.transAddress3 eq ''}"/>
                            <h:outputLabel value="," rendered="#{cc.attrs.con.collectingIns.transAddress3 ne null and cc.attrs.con.collectingIns.transAddress3 ne ''}"/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            <h:outputLabel value="#{cc.attrs.con.collectingIns.transAddress3}"/>
                            <h:outputLabel value="." rendered="#{(cc.attrs.con.collectingIns.transAddress4 eq null or cc.attrs.con.collectingIns.transAddress4 eq '') and (cc.attrs.con.collectingIns.transAddress3 ne null and cc.attrs.con.collectingIns.transAddress3 ne '')}"/>
                            <h:outputLabel value="," rendered="#{cc.attrs.con.collectingIns.transAddress4 ne null and cc.attrs.con.collectingIns.transAddress4 ne ''}"/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr><tr>
                        <td>
                            <h:outputLabel value="#{cc.attrs.con.collectingIns.transAddress4}"/>
                            <h:outputLabel value="." rendered="#{cc.attrs.con.collectingIns.transAddress4 ne null and cc.attrs.con.collectingIns.transAddress4 ne ''}"/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td>
                            <h:outputLabel value="Dear Sir/Madam,"/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td colspan="3">
                            <center>
                                <h:outputLabel value="SETTLEMENT OF INVESTIGATION BILL" style="text-decoration: underline; font-size: 15px!important;"/>
                            </center>
                        </td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            <h:outputLabel value="Period : " />
                            <h:outputLabel value="#{cc.attrs.con.fromDate}"  >
                                <f:convertDateTime pattern="dd MMM yyyy hh:mm:ss a" />
                            </h:outputLabel>
                            <h:outputLabel value=" - " />
                            <h:outputLabel value="#{cc.attrs.con.toDate}" >
                                <f:convertDateTime pattern="dd MMM yyyy hh:mm:ss a" />
                            </h:outputLabel>
                        </td>
                        <td></td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td colspan="3" width="100%">
                            <p:panel>
                                <p:dataTable id="safrin" value="#{cc.attrs.bills}" var="b" rowIndexVar="i" >  
                                    <p:column>
                                        <f:facet name="header">
                                            <p:outputLabel value="No" style="float: left;"/>
                                        </f:facet>
                                        <h:outputLabel value="#{i+1}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <p:outputLabel value="Bill No" style="float: left;" />
                                        </f:facet>
                                        <h:outputLabel value="#{b.insId}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <p:outputLabel value="Ref. No" style="float: left;" />
                                        </f:facet>
                                        <h:outputLabel value="#{b.referralNumber}" />
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <p:outputLabel value="Patient" style="float: left;"/>
                                        </f:facet>
                                        <h:outputLabel value="#{b.patient.person.nameWithTitle}"/>
                                    </p:column>
                                    <p:column styleClass="averageNumericColumn">
                                        <f:facet name="header">
                                            <h:outputLabel value="Hospital Charges"/>                        
                                        </f:facet>
                                        <h:outputLabel value="#{b.transTotalWithOutCCFee}">
                                            <f:convertNumber pattern="#,##0.00" />
                                        </h:outputLabel>
                                    </p:column>
                                    <p:column styleClass="averageNumericColumn">
                                        <f:facet name="header">
                                            <h:outputLabel value="Vat Charges"/>                        
                                        </f:facet>
                                        <h:outputLabel value="#{b.vat}">
                                            <f:convertNumber pattern="#,##0.00" />
                                        </h:outputLabel>
                                    </p:column>
                                    <p:column styleClass="averageNumericColumn">
                                        <f:facet name="header">
                                            <h:outputLabel value="Total Charges"/>                        
                                        </f:facet>
                                        <h:outputLabel value="#{b.vat+b.transTotalWithOutCCFee}">
                                            <f:convertNumber pattern="#,##0.00" />
                                        </h:outputLabel>
                                    </p:column>
                                </p:dataTable>
                                <f:facet name="footer">
                                    <h:outputLabel value="
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   Hospital Total : 
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   " style="font-weight: bold;"/>
                                    <h:outputLabel value="#{cc.attrs.con.totalHos}" style="font-weight: bold;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel><br></br>
                                    <h:outputLabel value="
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   VAT Total : 
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   " style="font-weight: bold;"/>
                                    <h:outputLabel value="#{cc.attrs.con.totalVat}" style="font-weight: bold;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel><br></br>
                                    <h:outputLabel value="
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   Net Total : 
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   " style="font-weight: bold;"/>
                                    <h:outputLabel value="#{cc.attrs.con.totalHos+cc.attrs.con.totalVat}" style="font-weight: bold;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </f:facet>
                            </p:panel>
                        </td>

                    </tr>



                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td colspan="3">
                            <p>
                                You are kindly requested to remit this amount by cheque written in favour of "
                                #{sessionController.loggedUser.institution.name} "
                                with the least Possible.
                            </p>
                        </td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td colspan="3">
                            <p>
                                * Please note that prevailing bank overdraft interest rate will be applied for all 
                                overdue debts.
                            </p>
                        </td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td colspan="3">
                            <p>
                                If you have any Questions about this invoice, please contact 
                                #{sessionController.loggedUser.staff.person.nameWithTitle} (Tel : 091-7212897).
                            </p>
                        </td>
                    </tr>

                    <tr>
                        <td><p:spacer height="10" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td>
                            <h:outputLabel value="Thanking You,"/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>

                    <tr>
                        <td>
                            <h:outputLabel value="Yours' Faithfully,"/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>

                    <tr>
                        <td><p:spacer height="40" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                    <tr>
                        <td>
                            <!--<h:outputLabel value="#{sessionController.loggedUser.staff.person.name},"/>-->
                        </td>
                        <td></td>
                        <td></td>
                    </tr>

                    <tr>
                        <td>
                            <!--<h:outputLabel value="#{sessionController.loggedUser.staff.speciality.name},"/>-->
                            <h:outputLabel value="Accountanat,"/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>

                    <tr>
                        <td>
                            <h:outputLabel value="#{sessionController.loggedUser.staff.workingDepartment.institution.name}."/>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td><p:spacer height="40" /></td>
                        <td><h:outputLabel value=" "/></td>
                        <td><h:outputLabel value=" "/></td>
                    </tr>

                </table>

            </div>
        </div>
    </cc:implementation>
</html>